// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

import axios from 'axios'//引入axios;
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';


Vue.prototype.$axios = axios;//把axios挂载到vue上

Vue.config.productionTip = false

Vue.use(ElementUI);

router.beforeEach((to, from, next) => {
  var isLogin=true;
  if(!isLogin && to.matched.some(function(item){
    // return item.path == '/hrMain';
    if(item.meta.loginRequired){
      return true;
    }
  })){
    next('/login');
  }else{
    next();
  }
  next();

})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  components: { App },
  template: '<App/>',
  router:router,
  // render:h=>(App),
})
